<template>
  <view class="container">
    <view class="hidden-title">隐患信息</view>
    <view class="background-white">
      <view class="flex text bor-btm">
        隐患类型：<text>{{ detail.managerLevelLabel }}</text>
      </view>
      <view class="flex text bor-btm">
        隐患级别：<text>{{ detail.managerTypeLabel }}</text>
      </view>
      <view class="flex text bor-btm">
        隐患描述：<text>{{ detail.managerDesc }}</text>
      </view>
      <view class="flex text bor-btm">
        隐患位置：<text>{{ detail.location }}</text>
      </view>
      <view class="flex text bor-btm">
        <view
          >相关照片
          <image-upload state="view" :imageUrl="detail.reportPhotoUrl"></image-upload>
        </view>
      </view>
    </view>
    <view class="submit-group">
      <button class="u-button block" :ripple="true" @click="distribute">派发任务</button>
      <button class="u-button block u-button-danger" :ripple="true" @click="reportToLeader">转办</button>
      <button class="u-button u-button-default block" :ripple="true" @click="end">取消</button>
    </view>
  </view>
</template>

<script>
import { getHiddenDangerInfo } from '@/api/dbd/hiddenDangerDeal.js'
import ImageUpload from '@/components/image-upload/index.vue'
export default {
  onLoad(option) {
    this.managerId = option.managerId
    this.getDetail(option.managerId)
    console.log(this.managerId)
  },
  components: {
    ImageUpload
  },
  data() {
    return {
      managerId: '',
      detail: {}
    }
  },
  methods: {
    getDetail(managerId) {
      getHiddenDangerInfo(managerId).then((res) => {
        this.detail = res.data
      })
    },
    distribute() {
      uni.navigateTo({
        url: `/pages/work/hiddenDangerDeal/components/distributeTask?managerId=${this.managerId}`
      })
    },
    reportToLeader() {
      uni.navigateTo({
        url: `/pages/work/hiddenDangerDeal/components/reportToLeader?managerId=${this.managerId}`
      })
    },
    end() {
      uni.navigateTo({
        url: `/pages/work/hiddenDangerDeal/end?managerId=${this.managerId}`
      })
      // uni.showModal({
      // 	title: '提示',
      // 	content: '确定取消该隐患上报吗？ ',
      // 	success: function(res) {
      // 		if (res.confirm) {

      // 		}
      // 	}
      // });
    }
  }
}
</script>

<style lang="scss" scoped>
.container {
  .background-white {
    background-color: #fff;
    padding: 20rpx 30rpx;
    box-sizing: border-box;

    .uni-forms-item__label {
      color: #333;
      font-size: 30rpx;
    }

    .bor-btm {
      display: flex;
      border-bottom: 1px solid #d5d7e3;
    }

    .photo {
      display: flex;
      justify-content: space-between;

      image {
        width: 214rpx;
        height: 214rpx;
      }
    }

    .text {
      padding-bottom: 20rpx;
      padding-top: 4rpx;
      color: #333;

      text {
        color: #666;
      }
    }
  }
}

.hidden-title {
  background: #f5f5f5;
  padding: 20rpx;
  color: #999;
}

.bor-top {
  border-top: 20rpx solid #f5f5f5;
}

.u-button {
  width: 600rpx;
}
</style>
